package model;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import org.json.JSONException;
import org.json.JSONObject;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by lenovo on 2016/8/29.
 */
public class AllPraiseModel {

    /**
     * result : 1
     * data : []
     * nextPage : 2
     * totals : 689
     * title : http://static.shandjj.com/images/app_brand_top2.png
     * brands : [{"brandId":"3679","brandName":"BOY London","brandIcon":"http://img.shandjj.com/fdc/2016/20160518/25/573c18d0bf385.jpg","likeNum":"141","max":"500","isDown":"0","isLike":0},{"brandId":"689","brandName":"Nike耐克","brandIcon":"http://img.mkf360.com/uploads/20150119/54bc6bbcb413d.jpg","likeNum":"277","max":"500","isDown":"1","isLike":0},{"brandId":"1777","brandName":"ZIPPO","brandIcon":"http://img.mkf360.com/uploads/20150630/5592589856eb2.jpg","likeNum":"20","max":"500","isDown":"1","isLike":0},{"brandId":"2365","brandName":"CK","brandIcon":"http://img.mkf360.com/uploads/20150119/54bca7330537a.jpg","likeNum":"57","max":"500","isDown":"0","isLike":0},{"brandId":"3797","brandName":"Supreme","brandIcon":"http://img.shandjj.com/fdc/2016/20160627/03/5770ebef1a5a6.jpg","likeNum":"388","max":"500","isDown":"1","isLike":0},{"brandId":"833","brandName":"Biotherm碧欧泉","brandIcon":"http://img.mkf360.com/uploads/20150119/54bc77f189a4f.jpg","likeNum":"206","max":"500","isDown":"0","isLike":0},{"brandId":"1776","brandName":"Levi's 李维斯","brandIcon":"http://img.mkf360.com/uploads/20150626/558d1b7220d59.jpg","likeNum":"322","max":"500","isDown":"0","isLike":0},{"brandId":"402","brandName":"CASIO卡西欧","brandIcon":"http://img.mkf360.com/uploads/20150721/55ae17e0603aa.jpg","likeNum":"51","max":"500","isDown":"0","isLike":0},{"brandId":"1707","brandName":"ECCO/爱步","brandIcon":"http://img.fdc.mkf.com/20150810/55c80c7c0f90f.jpg","likeNum":"386","max":"500","isDown":"0","isLike":0},{"brandId":"1711","brandName":"ABERCROMBIE&FITCH","brandIcon":"http://img.fdc.mkf.com/20151013/561c5da11ddd9.jpg","likeNum":"38","max":"500","isDown":"0","isLike":0},{"brandId":"994","brandName":"COACH","brandIcon":"http://img.fdc.mkf.com/20150824/55dacc3905c6b.jpg","likeNum":"263","max":"500","isDown":"0","isLike":0},{"brandId":"381","brandName":"初语","brandIcon":"http://img.mkf360.com/uploads/20150721/55adf32c033f8.jpg","likeNum":"277","max":"500","isDown":"0","isLike":0},{"brandId":"3097","brandName":"冈本","brandIcon":"http://img.fdc.mkf.com/20150817/55d14b68ac4a5.jpg","likeNum":"253","max":"500","isDown":"0","isLike":0},{"brandId":"3684","brandName":"阿玛尼Armani","brandIcon":"http://img.shandjj.com/fdc/2016/20160518/18/573c254d64196.jpg","likeNum":"52","max":"500","isDown":"0","isLike":0},{"brandId":"3681","brandName":"Aape","brandIcon":"http://img.shandjj.com/fdc/2016/20160518/16/573c24de11f11.jpg","likeNum":"418","max":"500","isDown":"0","isLike":0},{"brandId":"51","brandName":"AU&MU","brandIcon":"http://img.mkf360.com/uploads/20150708/559cd4ea9527a.jpg","likeNum":"238","max":"500","isDown":"0","isLike":0},{"brandId":"840","brandName":"碧欧泉","brandIcon":"http://img.fdc.mkf.com/20151009/5617317310b1b.jpg","likeNum":"219","max":"500","isDown":"0","isLike":0},{"brandId":"511","brandName":"speedo","brandIcon":"http://img.mkf360.com/uploads/20150727/55b5e1ca0bc10.jpg","likeNum":"32","max":"500","isDown":"0","isLike":0},{"brandId":"3664","brandName":"OMTO","brandIcon":"http://img.shandjj.com/fdc/2016/20160510/06/573188737c213.png","likeNum":"136","max":"500","isDown":"1","isLike":0},{"brandId":"3155","brandName":"尊蓝","brandIcon":"http://img.fdc.mkf.com/20151021/56273a9cc8809.jpg","likeNum":"29","max":"500","isDown":"1","isLike":0},{"brandId":"14","brandName":"战地吉普","brandIcon":"http://img.mkf360.com/uploads/20150707/559ba53e5ad6d.jpg","likeNum":"226","max":"500","isDown":"1","isLike":0},{"brandId":"3682","brandName":"BOY","brandIcon":"http://img.shandjj.com/fdc/2016/20160518/16/573c24f85aa8b.jpg","likeNum":"36","max":"500","isDown":"0","isLike":0},{"brandId":"3826","brandName":"HOLLISTER","brandIcon":"http://img.shandjj.com/fdc/2016/20160708/51/577f77a45486b.jpg","likeNum":"36","max":"500","isDown":"0","isLike":0},{"brandId":"1520","brandName":"HSTYLE韩都衣舍","brandIcon":"http://img.mkf360.com/uploads/20150706/559a4ade878e4.png","likeNum":"30","max":"500","isDown":"0","isLike":0}]
     */

    private int result;
    private int nextPage;
    private String totals;
    private String title;
    private List<?> data;
    /**
     * brandId : 3679
     * brandName : BOY London
     * brandIcon : http://img.shandjj.com/fdc/2016/20160518/25/573c18d0bf385.jpg
     * likeNum : 141
     * max : 500
     * isDown : 0
     * isLike : 0
     */

    private List<BrandsBean> brands;

    public static AllPraiseModel objectFromData(String str) {

        return new Gson().fromJson(str, AllPraiseModel.class);
    }

    public static AllPraiseModel objectFromData(String str, String key) {

        try {
            JSONObject jsonObject = new JSONObject(str);

            return new Gson().fromJson(jsonObject.getString(str), AllPraiseModel.class);
        } catch (JSONException e) {
            e.printStackTrace();
        }

        return null;
    }

    public static List<AllPraiseModel> arrayAllPraiseModelFromData(String str) {

        Type listType = new TypeToken<ArrayList<AllPraiseModel>>() {
        }.getType();

        return new Gson().fromJson(str, listType);
    }

    public static List<AllPraiseModel> arrayAllPraiseModelFromData(String str, String key) {

        try {
            JSONObject jsonObject = new JSONObject(str);
            Type listType = new TypeToken<ArrayList<AllPraiseModel>>() {
            }.getType();

            return new Gson().fromJson(jsonObject.getString(str), listType);

        } catch (JSONException e) {
            e.printStackTrace();
        }

        return new ArrayList();


    }

    public int getResult() {
        return result;
    }

    public void setResult(int result) {
        this.result = result;
    }

    public int getNextPage() {
        return nextPage;
    }

    public void setNextPage(int nextPage) {
        this.nextPage = nextPage;
    }

    public String getTotals() {
        return totals;
    }

    public void setTotals(String totals) {
        this.totals = totals;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public List<?> getData() {
        return data;
    }

    public void setData(List<?> data) {
        this.data = data;
    }

    public List<BrandsBean> getBrands() {
        return brands;
    }

    public void setBrands(List<BrandsBean> brands) {
        this.brands = brands;
    }

    public static class BrandsBean {
        private String brandId;
        private String brandName;
        private String brandIcon;
        private String likeNum;
        private String max;
        private String isDown;
        private int isLike;

        public static BrandsBean objectFromData(String str) {

            return new Gson().fromJson(str, BrandsBean.class);
        }

        public static BrandsBean objectFromData(String str, String key) {

            try {
                JSONObject jsonObject = new JSONObject(str);

                return new Gson().fromJson(jsonObject.getString(str), BrandsBean.class);
            } catch (JSONException e) {
                e.printStackTrace();
            }

            return null;
        }

        public static List<BrandsBean> arrayBrandsBeanFromData(String str) {

            Type listType = new TypeToken<ArrayList<BrandsBean>>() {
            }.getType();

            return new Gson().fromJson(str, listType);
        }

        public static List<BrandsBean> arrayBrandsBeanFromData(String str, String key) {

            try {
                JSONObject jsonObject = new JSONObject(str);
                Type listType = new TypeToken<ArrayList<BrandsBean>>() {
                }.getType();

                return new Gson().fromJson(jsonObject.getString(str), listType);

            } catch (JSONException e) {
                e.printStackTrace();
            }

            return new ArrayList();


        }

        public String getBrandId() {
            return brandId;
        }

        public void setBrandId(String brandId) {
            this.brandId = brandId;
        }

        public String getBrandName() {
            return brandName;
        }

        public void setBrandName(String brandName) {
            this.brandName = brandName;
        }

        public String getBrandIcon() {
            return brandIcon;
        }

        public void setBrandIcon(String brandIcon) {
            this.brandIcon = brandIcon;
        }

        public String getLikeNum() {
            return likeNum;
        }

        public void setLikeNum(String likeNum) {
            this.likeNum = likeNum;
        }

        public String getMax() {
            return max;
        }

        public void setMax(String max) {
            this.max = max;
        }

        public String getIsDown() {
            return isDown;
        }

        public void setIsDown(String isDown) {
            this.isDown = isDown;
        }

        public int getIsLike() {
            return isLike;
        }

        public void setIsLike(int isLike) {
            this.isLike = isLike;
        }
    }
}
